package com.cmccsi.uc.session;

import java.util.concurrent.ConcurrentMap;

import com.cmccsi.uc.redis.ICAsyncR;
import com.cmccsi.uc.redis.IRedisCsync;
import com.google.common.collect.MapMaker;
import com.thn.netty.chat.primitive.UserName;
import com.thn.netty.chat.server.ChannelInfo;




public class WORKER {

	//typedef std::tr1::unordered_map<String, String> SESSION_ID_MAP;		
	//pthread_t thread_id;
	private int ind;
	private int sfd;
	//struct event_base *base;
	private CONN_LIST conns;
	//struct event notify_event;
	private int notified_rfd;
	private int notifed_wfd;
	
	private SERVER server;
	//struct event session_id_timer_event;
	private int ulLastSessionIdCount;
	private int ulSessionIdCount;
	private ConcurrentMap<String, String> pmapSessionId=new MapMaker().concurrencyLevel(8).makeMap();
	private ConcurrentMap<String, String> pmapNewSessionId=new MapMaker().concurrencyLevel(8).makeMap();
	//pthread_mutex_t worker_lock ;//= PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
	private IRedisCsync psyncR;
	private ICAsyncR pasyncR;
	//struct event AsyncRedis_reconnect_timer_event;
	private ConcurrentMap<String, Object> pmapMsgs=new MapMaker().concurrencyLevel(8).makeMap();
	//struct event resend_timer_event;
	
	
	public WORKER()
	{
		pmapSessionId=new MapMaker().concurrencyLevel(8).makeMap();
		pmapNewSessionId=new MapMaker().concurrencyLevel(8).makeMap();
		pmapMsgs=new MapMaker().concurrencyLevel(8).makeMap();
	}
	
	
	public int getInd() {
		return ind;
	}
	
	public void setInd(int ind) {
		this.ind = ind;
	}
	public int getSfd() {
		return sfd;
	}
	public void setSfd(int sfd) {
		this.sfd = sfd;
	}
	public CONN_LIST getConns() {
		return conns;
	}
	public void setConns(CONN_LIST conns) {
		this.conns = conns;
	}
	public int getNotified_rfd() {
		return notified_rfd;
	}
	public void setNotified_rfd(int notified_rfd) {
		this.notified_rfd = notified_rfd;
	}
	public int getNotifed_wfd() {
		return notifed_wfd;
	}
	public void setNotifed_wfd(int notifed_wfd) {
		this.notifed_wfd = notifed_wfd;
	}	
	public SERVER getServer() {
		return server;
	}
	public void setServer(SERVER server) {
		this.server = server;
	}
	public int getUlLastSessionIdCount() {
		return ulLastSessionIdCount;
	}
	public void setUlLastSessionIdCount(int ulLastSessionIdCount) {
		this.ulLastSessionIdCount = ulLastSessionIdCount;
	}
	public int getUlSessionIdCount() {
		return ulSessionIdCount;
	}
	public void setUlSessionIdCount(int ulSessionIdCount) {
		this.ulSessionIdCount = ulSessionIdCount;
	}
	public ConcurrentMap<String, String> getPmapSessionId() {
		return pmapSessionId;
	}
	public void setPmapSessionId(ConcurrentMap<String, String> pmapSessionId) {
		this.pmapSessionId = pmapSessionId;
	}
	public ConcurrentMap<String, String> getPmapNewSessionId() {
		return pmapNewSessionId;
	}
	public void setPmapNewSessionId(ConcurrentMap<String, String> pmapNewSessionId) {
		this.pmapNewSessionId = pmapNewSessionId;
	}
	public IRedisCsync getPsyncR() {
		return psyncR;
	}
	public void setPsyncR(IRedisCsync psyncR) {
		this.psyncR = psyncR;
	}
	public ICAsyncR getPasyncR() {
		return pasyncR;
	}
	public void setPasyncR(ICAsyncR pasyncR) {
		this.pasyncR = pasyncR;
	}
	public ConcurrentMap<String, Object> getPmapMsgs() {
		return pmapMsgs;
	}
	public void setPmapMsgs(ConcurrentMap<String, Object> pmapMsgs) {
		this.pmapMsgs = pmapMsgs;
	}
}


/*
 * 
 * struct _WORKER {
	pthread_t thread_id;
	uint16 ind;
	int sfd;
	struct event_base *base;
	CONN_LIST *conns;
	struct event notify_event;
	int notified_rfd;
	int notifed_wfd;
	SERVER *server;
	struct event session_id_timer_event;
	uint64 ulLastSessionIdCount;
	uint64 ulSessionIdCount;
	SESSION_ID_MAP *pmapSessionId;
	SESSION_ID_MAP *pmapNewSessionId;
	pthread_mutex_t worker_lock ;//= PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
	CSyncR *psyncR;
	CAsyncR *pasyncR;
	struct event AsyncRedis_reconnect_timer_event;
	MSG_ID_MAP *pmapMsgs;
	struct event resend_timer_event;
};
 * */
 